﻿using System.Collections.Generic;
using System.Threading.Tasks;
using Leo.Awesome.AppPlatform.Dtos;
using Leo.Awesome.AppPlatform.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using static Leo.Awesome.AppPlatform.AppPlatfromApplcationContractsConsts;
namespace Leo.Awesome.AppPlatform.Controllers
{
    [Area(ModuleName)]
    [RemoteService(Name = RemoteServiceName)]
    [Route("api/[controller]")]
    [SwaggerTag("权限管理")]
    public class PermissionMenuController : AbpControllerBase, IPermissionMenuAppService
    {
        private readonly IPermissionMenuAppService permissionMenuAppService;

        public PermissionMenuController(IPermissionMenuAppService permissionMenuAppService)
        {
            this.permissionMenuAppService = permissionMenuAppService;
        }

        [HttpGet("getCurrUserPermission")]
        [SwaggerOperation(
             Summary = "获取当前用户权限",
             Description = "",
             OperationId = "",
             Tags = new[] { "PermissionMenu" }
           )]
        [Authorize(AppPlatformMenusView)]
        public async Task<List<MenuTreeOutput>> GetMenusForCurrentUser()
        {
            return await permissionMenuAppService.GetMenusForCurrentUser();
        }
    }
}
